home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8188 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.halcyon.com!usenet
  2. From: normanb@halcyon.com (Norm Bryar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Random dice program problem need help!!!!!
  5. Date: Thu, 15 Feb 1996 16:51:04 GMT
  6. Organization: Northwest Nexus Inc.
  7. Message-ID: <4fvo8n$jed@news.halcyon.com>
  8. References: <4fqum6$pbj@news.bellglobal.com>
  9. NNTP-Posting-Host: blv-pm10-ip5.halcyon.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. rchartra@feldspar.com (Ron Chartrand) wrote:
  13.  
  14. >I am using Borland C 4.52 i have been trying to make a callable
  15. >routine to simulate rolling 3 six sided dice but it always comes out
  16. >to be the same number?? need help!!!!!
  17.  
  18. >//3d6 dice roll
  19. >void Threed6()
  20. >{
  21. >randomize();
  22. >dice1=0;
  23. >dice2=0;
  24. >dice3=0;
  25.  
  26. >dice1=rand()%6+1;
  27. >dice2=rand()%6+1;
  28. >dice3=rand()%6+1;
  29. >Total=dice1+dice2+dice3;
  30. >}
  31.  
  32. >just Email me at rchartra@feldspar.com 
  33.  
  34. I'm not a Borland officianado, but one usually seeds the random number
  35. generator with some "random" value at the beginning, say, of program
  36. execution.  Usually one uses the time for the seed.  
  37.  
  38.     srand( (unsigned)time( NULL ) );  in MSVC
  39.  
  40. Does Borland's randomize() not accept a parameter for the seed value?
  41.  
  42.  
  43.                         --Norm 
  44.  
  45.  
  46.  
  47.